<template>
  <div class="top-bar">
    <div class="logo">
      <img src="@/assets/images/logo.svg" class="logo-img" />
      <p class="logo-name">苦甲子</p>
    </div>
    <div class="menu">
      <button-vue class="menu-message" :state="id == 0 ? 'cprimary': 'csecondary'" @click="changeWall(0)">留言墙
      </button-vue>
      <button-vue class="menu-photo" :state="id == 1 ? 'cprimary': 'csecondary'" @click="changeWall(1)">照片墙</button-vue>
    </div>
    <div class="user">
      <div class="user-head"></div>
    </div>
  </div>
</template>

<script setup>
import ButtonVue from "./Button.vue";
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
const id = computed(() => {
  return route.query.id
})

// 切换
const changeWall = (e) => {
  router.push({
    query: { id: e }
  })
}
</script>

<style lang="less" scoped>
.top-bar {
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.1);
  // 毛玻璃效果
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  box-sizing: border-box;

  .logo {
    display: flex;
    align-items: center;
    width: 200px;

    .logo-name {
      font-size: 20px;
      color: @gray-0;
      font-weight: 600px;
      padding-left: 10px;
    }
  }

  .menu {
    .menu-message {
      margin-right: 24px;
    }
  }

  .user {
    width: 200px;

    .user-head {
      float: right;
      border-radius: 50%;
      height: 36px;
      width: 36px;
      background-image: linear-gradient(180deg, #7be7ff, #1e85e2);
    }
  }
}
</style>
